#ifndef SPL_ENUMFORMATETC
#define SPL_ENUMFORMATETC

////////////////////////////////////////////////////////////////////////////////
// Based on enumformat.cpp by J Brown (www.catch22.net)

class EnumFormatEtc : public IEnumFORMATETC {
private:
    #pragma region Declarations
    //! Reference count
    LONG m_lRefCount;
    //! Enumeration formats
    FORMATETC *m_pFormatEtc;
    //! Storage medium index
    ULONG m_nIndex;
    //! Format count
    ULONG m_nNumFormats;
    #pragma endregion

public:
    #pragma region IUnknown
    //! Retrieves pointers to the supported interfaces on an object
    HRESULT WINAPI QueryInterface(REFIID iid, void **ppvObjectOut);
    //! Increments the reference count for an interface on an object
    ULONG WINAPI AddRef();
    //! Decrements the reference count for an interface on an object
    ULONG WINAPI Release();
    #pragma endregion

    #pragma region IEnumFORMATETC
    //! Retrieves the specified number of items in the enumeration sequence
    HRESULT WINAPI Next(ULONG celt, FORMATETC * rgelt, ULONG * pceltFetched);
    //! Skips over the specified number of items in the enumeration sequence
    HRESULT WINAPI Skip(ULONG celt);
    //! Resets the enumeration sequence to the beginning
    HRESULT WINAPI Reset(void);
    //! Creates a new enumerator that contains the same enumeration state
    //! as the current one
    HRESULT WINAPI Clone(IEnumFORMATETC **ppEnumFormatEtcOut);
    #pragma endregion

    #pragma region Constructors & Destructors
    EnumFormatEtc(FORMATETC *pFormatEtc, int nNumFormats);
    ~EnumFormatEtc();
    #pragma endregion
};

#endif